﻿
using ServiceWeb.APIRequest;
using UtilsORM;
using UtilsORM.MySqlData;

namespace ServiceWeb.DBGateway
{
    public class DBIotDeviceGatewayWifi
    {

        EFYihongIotContext ef = new EFYihongIotContext();
        public string Add(string wf_wifi_name,string wf_wifi_pwd, string gw_code)
        {
            try
            {
                // string command = "sudo service NetworkManager restart";
                // new ServiceSendMQ().sendBashCommand(command, gw_code);
                // new ServiceDeviceControl().sendbashCommand(gw_code, command, "后台");

                // Thread.Sleep(1 * 1000);
                string command = "nmcli device wifi connect \"" + wf_wifi_name + "\" password \"" + wf_wifi_pwd + "\"";
                //  string result = new ServiceSendMQ().sendBashCommand(command, gw_code);
                new ServiceDeviceControl().sendbashCommand(gw_code, command, "后台");

               // model.wf_add_time = DateTime.Now;
               // ef.iot_device_gateway_wifi.Add(model);
               // ef.SaveChanges();
                return "";
            }
            catch //(Exception ex)
            {

                return "";
            }
        }

    }

}
